package com.itheima.product.dao;

import com.itheima.pojo.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

public interface ProductMapper extends Mapper<Product> {
    @Update("update product set product.score =(SELECT avg(total_score) FROM `comment` where product_id=#{pid} group by id) WHERE product.id=#{pid}")
    int updateScore(@Param("pid") Integer pid);

}
